/**
*	will be included in CGame.h
*	specific vars and methods for gameplay
*/

public:

static int GetScreenWidth();
static int GetScreenHeight();
bool CheckCircleAndRect(float Cx, float Cy, float Cr, float Rx, float Ry, float Rw, float Rh);



#define MAX_TABLE	3600
float _sin_table[MAX_TABLE];
float _cos_table[MAX_TABLE];
float Math_AngleAbs(float angle);
float Math_Cos(float angle);
float Math_Sin(float angle);
void InitSinTable();
void InitCosTable();

// Animals
CAnimal _animals[ANIMAL_MAX_OBJECT];
int _current_num_animal;
void CreateAnimal(int type);
void RenderAnimals();
void UpdateAnimals();
void ResetAnimals();

// items
CItem _items[ANIMAL_MAX_OBJECT*2];
void CreateItem(float baseX, float baseY);
void RenderItems();
void UpdateItems();
void ResetItems();

// basket
float _basket_posX, _basket_posY;
void RenderBasket();
void UpdateBasket();
void UpdateTouchDrag();
bool _on_key_narrow_left, _on_key_narrow_right;

// game state
	//loading
	void UpdateLogo();
	void RenderLogo();
	int _loading_step;
	int _loading_opacity;
	int _flag_opacity;
	int _menu_opacity;
	
	//splash
	//#define SPLASH_MENU_BUTTON_NUM   3
	//void UpdateSplash();
	//void RenderSplash();
	//bool UpdateSplashTouch();
	//Button _splash_buttons[SPLASH_MENU_BUTTON_NUM];

	// game play
	void RenderGamePlay();
	void UpdateGamePlay();
	void TouchGamePlay();

	//about
	void RenderAbout();
	void UpdateAbout();
	bool TouchAbout();
	
	//pause
	void RenderPause();
	void UpdatePause();
	bool TouchPause();

	//result
	#define EXP_TO_LEVEL_UP		1000
	#define EXP_BONUS_PER_SHEEP	10
	void RenderResult();
	void UpdateResult();
	bool TouchResult();
	bool _on_wait_result;
	bool _on_new_high_score;
	bool _on_level_up;
	int _time_start_wait;


	bool IsTwoRectCollision(float x1, float y1, float w1, float h1, float x2, float y2, float w2, float h2);


	//game config
	CGame_Config _game_config;
	
	
	UINT32  _bg;
	bool _checkTouchScreen;

	CDevice _w_h;

	//score
	//CScore _score;


	void RemoveCharaterHP();
	void AddEggs();
	int GetCurrentLevel();
	


	//save system
	void SetCharAtHeader(char *buffer,int offset,char *header);//header of file
	char *GetCharAtHeader(char *buffer,int offset);

	void SetCharAtBeginEnd(char *buffer,int offset,char *chuck);//chuck begin
	char *GetCharAtB_E(char *buffer,int offset);

	void SetByteAt(char *buffer,int offset,int value);
	char GetByteAt(char *buffer,int offset);

	void SetIntAt16(char *buffer,int offset,int value);
	int GetIntAt16(char *buffer,int offset);

	void SetIntAt32(char *buffer,int offset,int value);
	int GetIntAt32(char *buffer,int offset);

	void SetFloatAt(char *buffer,int offset,float value);
	float GetFloatAt(char *buffer,int offset);

	#define GAME_SAVE_ID_DEFAULT	0
	#define GAME_SAVE_ID_CONTINUE	1



	

#define GAME_FILE		"data.dat"
//#define	GAME_HEADER		"CBDSGN"


